package com.sky.controller.admin;

import com.sky.result.Result;

import com.sky.utils.AliOSSUtils;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/admin/common")
@Api(tags = "通用接口")
public class UploadController {

    @Autowired
    private AliOSSUtils aliOssUtil;

    @PostMapping("/upload")
    public Result uplode(MultipartFile file) throws Exception {
        String url = aliOssUtil.upload(file);
        return Result.success(url);
    }
}
